<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/6/13
 * Time: 10:02
 */

function sqlQuery($sql){
    //1.创建数据库的链接
    $connection=new mysqli("127.0.0.1","root","","1902.1","3306");

    //2.设置链接字符集

    mysqli_query($connection,"set names utf8");

    //3.准备sql语句 传入

    //4.执行sql语句 获取结果

    $result=$connection->query($sql);

    //5.关闭数据库
    $connection->close();

    //6.返回结果

    return $result;
}